package com.zhangxu.microservice.auth.vo.resp;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhangxu.microservice.auth.common.enums.ResourceStatusEnum;
import com.zhangxu.microservice.auth.common.enums.ResourceTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 资源响应
 */
@Data
@Schema(description = "资源信息")
public class ResourceResp {

    @Schema(description = "资源ID", example = "1")
    private Long id;

    @Schema(description = "所属系统ID", example = "1")
    private Long systemId;

    @Schema(description = "父资源ID，顶级为0", example = "0")
    private Long parentId;

    @Schema(description = "资源名称", example = "用户管理")
    private String name;

    @Schema(description = "资源编码，唯一标识", example = "USER_MANAGE")
    private String code;

    @Schema(description = "资源类型：MENU/BUTTON/API", example = "MENU")
    private ResourceTypeEnum type;

    @Schema(description = "资源路径，如菜单路由/接口路径", example = "/user/list")
    private String path;

    @Schema(description = "请求方法，仅对API有效，如GET/POST/PUT/DELETE", example = "GET")
    private String method;

    @Schema(description = "是否可见：false-隐藏，true-可见（对菜单类有效）", example = "true")
    private Boolean visible;

    @Schema(description = "排序值，升序", example = "1")
    private Integer sort;

    @Schema(description = "备注说明", example = "用户管理菜单")
    private String remark;

    @Schema(description = "状态：ENABLE-启用、DISABLE-禁用、INIT-新建", example = "ENABLE")
    private ResourceStatusEnum status;

    @Schema(description = "创建人ID", example = "1")
    private Long createBy;

    @Schema(description = "更新人ID", example = "1")
    private Long updateBy;

    @Schema(description = "创建时间", example = "2023-01-01 12:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private LocalDateTime createTime;

    @Schema(description = "更新时间", example = "2023-01-01 12:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private LocalDateTime updateTime;
}